by Rob McGregor
In This Chapter
Windows controls, those doodads and widgets that make the Windows GUI so appealing, include both the Windows standard controls and the Windows common controls. The Windows standard controls include list boxes, edit boxes, combo boxes, scrollbars, and various types of buttons. The Windows common controls were introduced with Windows 95, and they add a lot of additional GUI power to the Windows programmers toolkit.
Because the common controls are specific to Win32, the MFC common control classes are available only to programs running under Windows 95 or later, Windows NT version 3.51 or later, and Windows 3.1x with Win32s 1.3 or later.
Before you can use any of the Windows common controls in your applications, you must initialize the common control DLLs with a Win32 API function call. Windows 95 applications use the InitCommonControls() function to register and initialize all the common control window classes. Its use is easy, as you can see by its function prototype:
void InitCommonControls(VOID);
The InitCommonControls() function is now obsolete; it has been replaced with the more intelligent InitCommonControlsEx() function, which loads only the specific control classes that you specify. Its function prototype looks like this:
BOOL InitCommonControlsEx(LPINITCOMMONCONTROLSEX lpInitCtrls);
InitCommonControlsEx() registers specific common control classes, specified by the parameter lpInitCtrls, from the common control dynamic-link library (DLL). The lpInitCtrls parameter is of type LPINITCOMMONCONTROLSEX, which is a structure containing information about which control classes to load from the common control DLL.
The INITCOMMONCONTROLSEX structure looks like this:
typedef struct tagINITCOMMONCONTROLSEX
{
DWORD dwSize;
DWORD dwICC;
}
INITCOMMONCONTROLSEX, *LPINITCOMMONCONTROLSEX;
The parameters are as follows:
| Bit Flags Name | Meaning |
|---|---|
| ICC_ANIMATE_CLASS | Loads the animate control class. |
| ICC_BAR_CLASSES | Loads the toolbar, status bar, trackbar, and tooltip control classes. |
| ICC_COOL_CLASSES | Loads the rebar control class. |
| ICC_DATE_CLASSES | Loads the date and time picker control class. |
| ICC_HOTKEY_CLASS | Loads the hot key control class. |
| ICC_INTERNET_CLASSES | Loads the IP address class. |
| ICC_LISTVIEW_CLASSES | Loads the list view and header control classes. |
| ICC_PAGESCROLLER_CLASS | Loads the pager control class. |
| ICC_PROGRESS_CLASS | Loads the progress bar control class. |
| ICC_TAB_CLASSES | Loads the tab and tooltip control classes. |
| ICC_TREEVIEW_CLASSES | Loads the tree view and tooltip control classes. |
| ICC_UPDOWN_CLASS | Loads the up-down control class. |
| ICC_USEREX_CLASSES | Load the ComboBoxEx class. |
| ICC_WIN95_CLASSES | Loads the animate control, header, hot key, list view, progress bar, status bar, tab, tooltip, toolbar, trackbar, tree view, and up-down control classes. |